home *** CD-ROM | disk | FTP | other *** search
- /*
- * File: Service.h
- *
- * Contains: xxx put contents here xxx
- *
- * Written by: Rick Violet
- *
- * Copyright: © 1992 by Apple Computer, Inc., all rights reserved.
- *
- * Change History (most recent first):
- *
- * 11/18/92 RV xxx put comment here xxx
- *
- * To Do:
- */
-
- #ifndef __Service__
- #define __Service__
-
- #ifndef __ERRORS__
- #include <Errors.h>
- #endif
-
- #ifndef __STRING__
- #include <String.h>
- #endif
-
- #ifndef __VUAE__
- #include "VUAE.h"
- #endif
-
- #ifndef __Object__
- #include "Object.h"
- #endif
-
- class Service; //———— Forward declaration for RequestDispatcher.h
-
- #ifndef __RequestDispatcher__
- #include "RequestDispatcher.h"
- #endif
-
- #ifndef __Request__
- #include "Request.h"
- #endif
-
- //—————————————————————————————————————————————————————————————————————————————————————
- // Service class - base class for all custom Request handler classes
- // This class executes a specific Request from V.U.
- // The Service is identified by name
- //—————————————————————————————————————————————————————————————————————————————————————
- class Service : public Object
- {
- private: //———————————————————————
-
- OSErr fError;
-
- protected: //———————————————————————
-
- char* fSrvNameText;
- long fTimeOutInterval;
-
- public: //———————————————————————
-
- Service( char* pSrvName ); // constructor
- virtual ~Service(void); // destructor
-
- //———— called when V.U. sends an initialize message to the tool
- virtual void Initialize( Request* pReq ){ if( pReq ); /*abstract method*/};
-
- virtual Boolean CanDoService( char* pServiceName ); // Determines if this Request is handled by handler
- virtual OSErr ProcessRequest( Request* pReq ); // Implements the Request
-
- virtual ScriptValue* GetServiceNameText();
-
- /*SBR Hacked new parameter in 10/16/94 */
- virtual Boolean CheckForCancel( Request* pReq, Boolean yieldTime = true );
-
- /*SBR Hacked this in 10/16/94 */
- void SetTimeOutInterval( long pNewTimeOutInterval );
- long GetTimeOutInterval( );
- virtual long GetDefaultTimeOutInterval( );
-
- virtual Boolean IsThreaded( ) { return false; };
-
- };
-
-
- /*SBR Hacked this in 10/16/94 */
- //—————————————————————————————————————————————————————————————————————————————————————
- // ThreadedService class - Just like a service, but has more stuff for threading.
- // Override MyStackSize and MyThreadOptions to set these
- // NewThread() parameters to other values for your service.
- //—————————————————————————————————————————————————————————————————————————————————————
- class ThreadedService : public Service
- {
- private: //———————————————————————
-
-
- public: //———————————————————————
-
- ThreadedService( char* pSrvName ); // constructor
- virtual ~ThreadedService( ); // destructor
-
- Boolean IsThreaded( ) { return true; };
-
- virtual Size MyStackSize( ) { return (Size) 0; };
- Size GetStackSize( ) { return (Size) 0 + MyStackSize( ); };
-
- virtual ThreadOptions MyThreadOptions( ) { return kCreateIfNeeded + kFPUNotNeeded; };
- ThreadOptions GetThreadOptions( ) { return (ThreadOptions)
- kNewSuspend | MyThreadOptions( ); };
- };
-
- #endif
-